import { defineStore } from "pinia";

const userStore = defineStore("user", {
    state: () => {
        return {
            token: "",
            name: "无心",
        };
    },
    getters: {
        fullName(state) {
            return "邢"+state.name;
        },
    },
    actions: {
        setToken(token) {
            this.token = token;
        },
        updateName(name) {
            this.name = name;
        },
    },
    persist: {
        enabled: true
    } // 开启pinia持久化
});

export default userStore